package com.umeox.moto.watch.themes.widget.loader;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;

public class LineFadeLoaderIndicator extends BallSpinFadeLoaderIndicator {

    @Override
    public void draw(Canvas canvas, Paint paint) {
        float radius = getWidth() / 6;
        for (int i = 0; i < ELEMENT_COUNT; i++) {
            canvas.save();
            Point point = circleAt(getWidth(), getHeight(), radius * 2, i * (2 * Math.PI / ELEMENT_COUNT));
            canvas.translate(point.x, point.y);
            canvas.rotate(i * (360f / ELEMENT_COUNT));
            paint.setAlpha(alphas[i]);
            RectF rectF = new RectF(-radius * 0.5f, -radius / 3.5f, radius * 1.5f, radius / 3.5f);
            canvas.drawRect(rectF, paint);
            canvas.restore();
        }
    }
}
